#include <iostream>
#include <algorithm>
using namespace std;
const int N = 15;
int t, n, m;
int f[N][N];

int main(int argc, char const *argv[])
{
    cin >> t;
    while (t--)
    {
        cin >> m >> n;
        f[0][0] = 1;
        for (int i = 0; i <= m; i++)
            for (int j = 0; j <= n; j++)
            {
                f[i][j] = f[i][j - 1];
                if (i >= j)
                    f[i][j] += f[i - j][j];
            }
        cout << f[m][n];
    }
    return 0;
}
